package com.user.profile.enums;

import lombok.Getter;

@Getter
public enum OperateEnum {

  AND(0, "and"),
  OR(1, "or"),
  EQ(2, "="),
  NEQ(3, "!="),
  DO(4, "做过"),
  NOT_DO(5, "没做过"),
  GE(6, ">=")
  ;


  @Getter
  private final Integer code;
  @Getter
  private final String name;

  OperateEnum(int code, String name) {
    this.code = code;
    this.name = name;
  }

  public static OperateEnum get(Integer code) {
    if (code != null) {
      for (OperateEnum e : values()) {
        if (e.code.equals(code)) {
          return e;
        }
      }
    }
    return null;
  }
}
